package IC.AST;

public class IfStatement extends Statement
{
	private Expression _ifExpression;
	private Statement _firstPart, _secondPart;
	
	public Object Visit(Visitor visitor) { return visitor.Visit(this); }
	
	public IfStatement(Interval interval, Expression ifExpression, Statement firstStatement, Statement secondStatement)
	{
		super(interval);
		GiveBirth(ifExpression);
		GiveBirth(firstStatement);
		if (secondStatement != null)
			GiveBirth(secondStatement);
		
		_ifExpression = ifExpression;
		_firstPart = firstStatement;
		_secondPart = secondStatement;
	}
	
	public Expression GetIfExpression() { return _ifExpression; }
	public Statement GetFirstPart()	{ return _firstPart; }
	public Statement GetSecondPart() { return _secondPart; }
}
